package cn.dudup.androidstudy;

import cn.dudup.shared.LocationService;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class Main extends Activity {
	
	LocationService locService = new LocationService(Main.this);
			

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        locService.initLocation();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
  	protected void onDestroy() {
  		locService.stopListener();
  		super.onDestroy();
  	}

  	public void getShopList(View view) {
  		Intent intent = new Intent(this, ShopListActivity.class);
  		intent.putExtra("cn.dudup.androidstudy.longitude", locService.getLongitude());
  		intent.putExtra("cn.dudup.androidstudy.latitude", locService.getLatitude());
  		intent.putExtra("cn.dudup.androidstudy.searchKey", view.getId());
  		startActivity(intent);
  	}
  	
}

